package com.CST.mapper.cst.cb;

import com.CST.dto.cb.DateDTO;
import com.CST.entity.cb.BaseCost;
import com.CST.entity.cb.CostDataInfo;
import com.CST.entity.cb.Direct;
import com.CST.vo.cb.*;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Repository;

import java.util.List;

@Repository
public interface BaseCostMapper extends BaseMapper<BaseCost> {
    List<Direct> listDeptAndAccountWithSumByDate(DateDTO dateDTO);

    List<BaseCost> getAllBaseCostByDate(DateDTO dateDTO);
    
    List<BaseCost> listAll(DateDTO dateDTO);

    List<ReportAmortizationDataVO> listBaseCostWithCostItem(DateDTO dateDTO);
    
    List<ReportBaseCostVO> listCostWithPDeptAndCostType(DateDTO dateDTO);

    void insertBaseCost(@Param("list") List<BaseCost> insertList1, @Param("year") Integer year);
    void insertBaseCostDel(@Param("list") List<BaseCost> insertList1, @Param("year") Integer year);

    boolean insertBaseCostOne(@Param("item") BaseCost baseCost);

    boolean updateBaseCostOne(@Param("item") BaseCost baseCost);

    boolean deleteBaseCostOne(long id,int year);

    List<BaseCost> listBaseCost(CostDataInfo costDataInfo);

    /**
     * 根据年月删除
     */
    void deleteByYearAndMonth(@Param("year") Integer year, @Param("month") Integer month);
    void deleteDelByYearAndMonth(@Param("year") Integer year, @Param("month") Integer month);
    List<BaseAllCostVO> listBaseCostDeptByDate(@Param("dateDTO") DateDTO dateDTO);
    /**
     * 获取成本数据
     * 包含科室-父级科室
     * 可选：父级科室编码
     */
    List<BaseCostVO> listBaseCostWithPDept(@Param("dateDTO") DateDTO dateDTO, @Param("pDeptCode") String pDeptCode);

    /**
     * 人员经费一级明细
     * 需要传入PDeptCode，年月时间，EXTRA_A，通过EXTRA_A控制查询的人员经费
     * EXTRA_A = detail为薪酬系统人员经费
     * EXTRA_A = null为绩效系统人员经费
     */
    List<ReportBaseSalaryVO> listSalaryWithExtraByPDeptCode(@Param("dateDTO") DateDTO dateDTO, @Param("pDeptCode") String pDeptCode);

    List<ReportBaseSalaryVO> listSalaryWithExtraByDeptCode(@Param("dateDTO") DateDTO dateDTO, @Param("deptCode") String deptCode);

    /**
     * 人员经费 绩效 二级明细
     * 传入时间+父级科室+子科室
     * @param dateDTO
     * @param pDeptCode
     * @param deptCode
     * @return
     */
    List<ReportBaseSalaryVO> listPerformanceDetailByDateAndPDeptAndDept(@Param("dateDTO") DateDTO dateDTO, @Param("pDeptCode") String pDeptCode, @Param("deptCode") String deptCode);

    List<ReportBaseSalaryVO> getOffsetSalary(DateDTO dateDTO);

    List<DeptBaseCostVO>  getDeptBaseCost(@Param("dateDTO") DateDTO dateDTO);

}
